/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package clases;

import java.io.IOException;
import java.io.RandomAccessFile;

/**
 *
 * @author Senpai
 */
public class FicheroClase {
   private RandomAccessFile raf;

   public void escribirFichero(long num, Escuderia escuderia) 
                                          throws IOException {
     this.raf.seek(num * escuderia.SIZE);
     byte[] record = escuderia.toBytes();
     this.raf.write(record);
   }

  public Escuderia leerFichero(long num) throws IOException {
     this.raf.seek(num * Escuderia.SIZE);
     byte[] record = new byte[Escuderia.SIZE];
     this.raf.read(record);
     return Escuderia.fromBytes(record);
}
}
